<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <link
      href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css"
      rel="stylesheet"
    />
    <title>云中仙蕊</title>
    <link rel="stylesheet" href="./css/base.css" />
    <link rel="stylesheet" href="./css/all.css" />
    <link rel="stylesheet" href="./css/goodsDet.css" />
  </head>
  <body>
    <!-- 导航栏 -->
    <nav class="navbar navbar-expand-lg navbar-dark fixed-top">
      <div class="container-fluid" id="nav-container"></div>
    </nav>

    <div
      style="width: 99vw; display: flex; padding-top: 80px"
      class="flex goodsDet"
    >
      <div
        class="flex flex-col items-center justify-center min-h-screen bg-gray-100"
      >
        <img
          id="mainImage"
          src="./images/goods1.png"
          class="cursor-pointer shadow-md rounded-md"
        />
        <ul style="display: flex">
          <li id="prevButton">向前</li>
          <li class="imagesLi"></li>
          <li id="nextButton">向后</li>
        </ul>
      </div>

      <div style="width: 70%">
        <!-- 商品标题 -->
        <h1 style="width: 100%">
          云中蕊红参阿胶元气茶女人女性养生礼盒气血不足湿气重桂圆山药茯苓枸杞
          人参五宝茶【15罐】
        </h1>
        <!-- 促销横幅 -->
        <div class="promotion-banner">
          <span>春日出游 又好又便宜</span>
        </div>
        <!-- 价格信息 -->
        <div class="price-info" style="width: 100%">
          <span class="original-price">价 格 ￥69.00</span>
          <span class="current-price">到手价 ￥48</span>
          <span class="jd-price">京东价</span>
          <span class="price-notice">降价通知</span>
          <span class="evaluation">累计评价 200+</span>
        </div>
        <!-- 促销活动 -->
        <div class="promotion-activities" style="width: 100%">
          <span class="first-purchase">首购礼金</span>
          <span class="discount-desc">下单立减21元,店铺新客限时优惠</span>
          <br />
          <br />
          <span class="cross-store">跨店满减</span>
          <span class="cross-store-desc"
            >每满200元，可减30元现金，最多可减40000元 | 距结束还剩
            5天12小时45分1秒</span
          >
          <a href="#" class="detail-link">详情>></a>
        </div>

        <!-- 颜色选择 -->
        <div class="color-choice" style="width: 100%">
          <span class="color">选择颜色</span>
          <div class="color-options">
            <div class="product-option">
              <img src="product1.png" alt="红参阿胶元气茶【15罐】" />
              <span>红参阿胶元气茶【15罐】</span>
            </div>
            <div class="product-option">
              <img src="product2.png" alt="红参桂圆姜丝茶【15罐】" />
              <span>红参桂圆姜丝茶【15罐】</span>
            </div>
            <div class="product-option">
              <img src="product3.png" alt="红参玫瑰元气茶【15罐】" />
              <span>红参玫瑰元气茶【15罐】</span>
            </div>
            <div class="product-option">
              <img src="product4.png" alt="人参枸杞桑葚茶【15罐】" />
              <span>人参枸杞桑葚茶【15罐】</span>
            </div>
            <div class="product-option selected">
              <img src="product5.png" alt="人参五宝茶【15罐】" />
              <span>人参五宝茶【15罐】</span>
            </div>
            <div class="product-option">
              <img src="product6.png" alt="酸枣仁百合茶【15罐】" />
              <span>酸枣仁百合茶【15罐】</span>
            </div>
          </div>
        </div>
      </div>
    </div>

    <footer>
      <div class="container footer-container">
        <div class="row">
          <div class="col-12 col-md-4 footer-left">
            <img src="./images//qrcode.png" alt="二维码" />
            <p class="mt-3">服务热线：<br />4008005881</p>
            <p>邮箱：yunzhongrui_tea@163.com</p>
            <p>地址：安徽省合肥市政务区蔚蓝商务港</p>
          </div>
          <div class="col-12 col-md-8">
            <div class="row">
              <div class="col-6 col-md-3">
                <ul class="footer-links">
                  <li><a href="#">关于我们</a></li>
                  <li><a href="#">公司概况</a></li>
                  <li><a href="#">联系我们</a></li>
                </ul>
              </div>
              <div class="col-6 col-md-3">
                <ul class="footer-links">
                  <li><a href="#">品牌资讯</a></li>
                  <li><a href="#">公司新闻</a></li>
                  <li><a href="#">媒体报道</a></li>
                </ul>
              </div>
              <div class="col-6 col-md-3">
                <ul class="footer-links">
                  <li><a href="#">茶饮系列</a></li>
                  <li><a href="#">小罐茶系列</a></li>
                  <li><a href="#">蜂蜜系列</a></li>
                  <li><a href="#">原料茶系列</a></li>
                </ul>
              </div>
              <div class="col-6 col-md-3">
                <ul class="footer-links">
                  <li><a href="#">茶饮系列</a></li>
                  <li><a href="#">小罐茶系列</a></li>
                  <li><a href="#">蜂蜜系列</a></li>
                  <li><a href="#">原料茶系列</a></li>
                </ul>
              </div>
            </div>
          </div>
        </div>
        <div class="copyright mt-4">
          Copyright 2001-2023 安徽云中蕊品牌有限公司版权所有
        </div>
      </div>
    </footer>
    <!-- 引入Bootstrap JS -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
    <script src="./js/navData.js"></script>
    <script src="./js/navAllFunc.js"></script>
    <script>
      navAllfunc1(); //调用导航栏函数 数据

      const images = [
        "./images/goods1.png",
        "./images/goods2.png",
        "./images/xczx2.png",
      ];
      const li = document.querySelector(".imagesLi");
      let lIhtml = [];
      images.forEach((image) => {
        lIhtml.push(`<img src="${image}" alt="Image" />`);
      });
      li.innerHTML = lIhtml.join("");
      let currentIndex = 0;
      const mainImage = document.getElementById("mainImage");
      const prevButton = document.getElementById("prevButton");
      const nextButton = document.getElementById("nextButton");

      function updateMainImage() {
        mainImage.src = images[currentIndex];
      }

      prevButton.addEventListener("click", function () {
        currentIndex = (currentIndex - 1 + images.length) % images.length;
        updateMainImage();
      });

      nextButton.addEventListener("click", function () {
        currentIndex = (currentIndex + 1) % images.length;
        updateMainImage();
      });

      li.addEventListener("click", function (event) {
        if (event.target.tagName === "IMG") {
          const index = Array.from(li.children).indexOf(event.target);
          currentIndex = index;
          updateMainImage();
        }
      });

      // 这里可以添加一些交互逻辑，比如颜色选择的点击事件等
      const productOptions = document.querySelectorAll(".product-option");
      productOptions.forEach((option) => {
        option.addEventListener("click", function () {
          productOptions.forEach((opt) => opt.classList.remove("selected"));
          this.classList.add("selected");
        });
      });
    </script>
  </body>
</html>
